package com.haoshuang.zhouzhoubang.ui.page.order.appeal.detail

import com.haoshuang.zhouzhoubang.model.api.ApiRepo
import com.haoshuang.zhouzhoubang.model.bean.AppealDetailBean
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.net.netRequest
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData

class AppealDetailViewModel : BaseViewModel() {

    /**
     * 差评申诉详情
     */
    val userOrderAppealInfoData = StatefulMutableLiveData<AppealDetailBean>()
    fun userOrderAppealInfo(orderId: Int?) = netRequest {
        start { userOrderAppealInfoData.value = StateData.Loading }
        request { ApiRepo.userOrderAppealInfo(orderId)  }
        success { userOrderAppealInfoData.value = StateData.Success(it.data) }
        error { code, msg ->
            userOrderAppealInfoData.value = StateData.Error(code, msg)
        }
    }

}